package com.weiqiao.mall.rest;

import com.weiqiao.aop.log.Log;
import com.weiqiao.mall.service.IDistributeService;
import com.weiqiao.mall.service.vo.DistributeVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * 分销设置控制层
 *
 * @author
 */
@RestController
@RequestMapping("/api")
public class DistributeController {

    @Autowired
    private IDistributeService distributeService;

    @Log("分销设置")
    @GetMapping("/get-distribute")
    public ResponseEntity getDistribute(int company_id) {
        return new ResponseEntity(distributeService.findOne(company_id), HttpStatus.OK);
    }

    @Log("更新分销设置")
    @PostMapping("/update-distribute")
    public ResponseEntity updateDistribute(@RequestBody DistributeVO distributeVO) {
        return new ResponseEntity(distributeService.updateDistribute(distributeVO), HttpStatus.OK);
    }
}
